/**
 * Copyright (C) 2012 The SkyTvOS Project
 * <p/>
 * Version     Date           Author
 * ─────────────────────────────────────
 * 2014年12月26日         cassie
 */

package com.coocaa.launcher.util;

import java.io.FileInputStream;
import java.io.FileNotFoundException;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.RemoteException;
import android.view.Display;
import android.view.WindowManager;

public class Utils {
    public static Drawable loadDrawableFromPath(String filePath) {
        Drawable drawable = null;
        try {
            FileInputStream fis;
            fis = new FileInputStream(filePath);
            Bitmap bm = BitmapFactory.decodeStream(fis);
            if (bm != null)
                drawable = new BitmapDrawable(bm);
        } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return drawable;
    }

    public static int getScreenWidth(Context mContext) {
        Display display = ((WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE))
                .getDefaultDisplay();
        int W = display.getWidth();
        return W;
    }

    public static int getScreenHeight(Context mContext) {
        Display display = ((WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE))
                .getDefaultDisplay();
        int H = display.getHeight();
        return H;
    }
}
